﻿<cfcomponent>

<cfscript>
DB = 'chinalaohu';
</cfscript>
<cfparam name="UUID" default="0" type="string" >


<!---账户主页接口--->
<cffunction name="home" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
  <!---新增KEY--->
  <cfif isdefined('key')>
  
  	<cfscript>
		newkey = hash(UUID & 'laohu123','MD5');
		</cfscript>
  <cfif key neq newkey>
		<cfscript>
		//KEY不正确
    j = {"success":"0","errCode":"-1"};
    </cfscript>
  
  <cfelse>
  
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
  <cfif uuidgetuid.recordcount neq 1>
  	<!---"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
  <!---会员资料完整度--->
  <cfinvoke component="app.cfc.user" method="userDataIntegrity" returnvariable="userDataIntegrity" uid="#uuidgetuid.uid#" />
  
 
		<!---余额--->
    <cfinvoke component="app.cfc.recharge" method="getuserrecharge" returnvariable="getuserrecharge" uid="#uuidgetuid.uid#" />
    
<!---保证金--->
<cfinvoke component="app.cfc.deposit" method="getbzjvalue" returnvariable="userdeposit" uid="#uuidgetuid.uid#" />
<!---认证额度--->
<cfinvoke component="app.cfc.credit" method="userCreditAuth" returnvariable="userCreditAuth" uid="#uuidgetuid.uid#" />
<!---竞拍额度--->
<cfinvoke component="app.cfc.credit" method="userCredit" returnvariable="userCredit" CreditLimit="#userCreditAuth#" uid="#uuidgetuid.uid#" />
<!---可用额度--->
<cfinvoke component="app.cfc.deposit" method="getbzj_ed" returnvariable="bzj_ed" CreditLimit="#userCredit#" uid="#uuidgetuid.uid#" />
<!---竞买记录数--->
<cfinvoke component="app.cfc.userlastbid" method="mybidrecord" returnvariable="mybidrecord" uid="#uuidgetuid.uid#" />
<!---竞买记录数--->
<cfinvoke component="app.cfc.userconcern" method="mygzrecord" returnvariable="mygzrecord" uid="#uuidgetuid.uid#" />
<!---订单总数--->
<cfinvoke component="app.cfc.userwonpaid" method="allpaidlistrecord" returnvariable="allpaidlistrecord" uid="#uuidgetuid.uid#" />
<!---未支付--->
<cfinvoke component="app.cfc.userlastbid" method="userunintopaidrecord" returnvariable="userunintopaidrecord" uid="#uuidgetuid.uid#"/>
<!---已发货--->
<cfinvoke component="app.cfc.userwonpaid" method="sendOutrecord" returnvariable="sendOutrecord" uid="#uuidgetuid.uid#"/>
<cfscript>
//保证金
if (userdeposit eq 0)
deposit = 0;
else 
deposit = userdeposit;
//可用保证金
kybzj = deposit;
//认证额度 - 可用额度
othered = userCredit - userCreditAuth;

if (othered gt 0){
	kybzj = othered / 50;
}
name = uuidgetuid.realname;
if (len(name) eq 0){
	//name = uuidgetuid.mobile;
	name = left(uuidgetuid.mobile,3) & '*****' & right(uuidgetuid.mobile,3);
}

//积分 
points = 0;

//关注
attention = 0;

//订单数
deal = allpaidlistrecord.rc;
</cfscript>
<cfstoredproc procedure="pro_get_user_level" dataSource="#DB#"> 
    <cfprocparam type="IN" CFSQLType="cf_sql_varchar" value="#uuidgetuid.uid#" > 
    <cfprocparam type="OUT" CFSQLType="cf_sql_integer" variable="urank_proc"> 
</cfstoredproc> 
<cfscript>
function urankfunc(urank){
	switch(urank){
		case 0:
			return '注册会员';
			break;
		case 1:
			return '一钻会员';
			break;
		case 2:
			return '二钻会员';
			break;
		case 3:
			return '三钻会员';
			break;
		case 4:
			return '四钻会员';
			break;
		case 5:
			return '五钻会员';
			break;
		case 6:
			return '一皇冠';
			break;
		case 7:
			return '二皇冠';
			break;
	}
}



j = {
"success":"1",
"account":{
	"name": name,
	"urank":urankfunc(urank_proc),
	"infoDegree":userDataIntegrity,
	"state":uuidgetuid.ustatus,
	"avail":bzj_ed,
	"margin":kybzj,
	"balance":getuserrecharge,
	"points":points,
	"record":mybidrecord,
	"attention":mygzrecord,
	"nonPayment":userunintopaidrecord,
	"sendOut":sendOutrecord,
	"deal":deal
}
};
</cfscript>
  
  </cfif>
  
  </cfif>
  <cfelse>
		<cfscript>
		//KEY未提交
    j = {"success":"0","errCode":"-1"};
    </cfscript>
  
  </cfif>
  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>




<!---财务账户接口--->
<cffunction name="finance" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
  <cfif uuidgetuid.recordcount neq 1>
  	<!---,"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
		<!---余额--->
    <cfinvoke component="app.cfc.recharge" method="getuserrecharge" returnvariable="getuserrecharge" uid="#uuidgetuid.uid#" />
    
    
<!---保证金--->
<cfinvoke component="app.cfc.deposit" method="getbzjvalue" returnvariable="userdeposit" uid="#uuidgetuid.uid#" />
<cfscript>
if (userdeposit eq 0)
deposit = 0;
else 
deposit = userdeposit;
</cfscript>
<!---认证额度--->
<cfinvoke component="app.cfc.credit" method="userCreditAuth" returnvariable="userCreditAuth" uid="#uuidgetuid.uid#" />
<!---竞拍额度--->
<cfinvoke component="app.cfc.credit" method="userCredit" returnvariable="userCredit" CreditLimit="#userCreditAuth#" uid="#uuidgetuid.uid#" />
<!---可用额度--->
<cfinvoke component="app.cfc.credit" method="userCreditLimit" returnvariable="userCreditLimit" CreditLimit="#userCredit#" uid="#uuidgetuid.uid#" />

<cfscript>
//可用保证金
kybzj = deposit;
//认证额度 - 可用额度
othered = userCredit - userCreditAuth;

if (othered gt 0){
	kybzj = othered / 50;
}

j = {
"success":"1",
"finance":{
"balance":numberformat(getuserrecharge,'_.__'),
"deposit":numberformat(kybzj,'_.__'),
"auction":numberformat(userCreditLimit,'_.__')
}
};
</cfscript>
    
    
  
  </cfif>
  

  
  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>


<!---竞拍额度页接口--->
<cffunction name="creditpage" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#">
  <cfif uuidgetuid.recordcount neq 1>
  	<!---,"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
		<!---余额--->
    <cfinvoke component="app.cfc.recharge" method="getuserrecharge" returnvariable="getuserrecharge" uid="#uuidgetuid.uid#" />
    
    
<!---保证金--->
<cfinvoke component="app.cfc.deposit" method="getbzjvalue" returnvariable="userdeposit" uid="#uuidgetuid.uid#" />
<cfscript>
if (userdeposit eq 0)
deposit = 0;
else 
deposit = userdeposit;
</cfscript>
<!---认证额度--->
<cfinvoke component="app.cfc.credit" method="userCreditAuth" returnvariable="userCreditAuth" uid="#uuidgetuid.uid#" />
<!---竞拍额度--->
<cfinvoke component="app.cfc.credit" method="userCredit" returnvariable="userCredit" CreditLimit="#userCreditAuth#" uid="#uuidgetuid.uid#" />
<!---可用额度--->
<cfinvoke component="app.cfc.credit" method="userCreditLimit" returnvariable="userCreditLimit" CreditLimit="#userCredit#" uid="#uuidgetuid.uid#" />

<cfscript>
//可用保证金
kybzj = deposit;
//认证额度 - 可用额度
//othered = userCreditAuth - userCreditLimit;
othered = userCredit - userCreditAuth;

if (othered gt 0){
	kybzj = othered / 50;
}

//occupy = userCredit - userCreditLimit;
occupyCredit = userCredit - userCreditLimit;

yzybzj = deposit - kybzj;

j = {
"success":"1",
"other":othered,
"auctionLimit":{
	"sysCredit":numberformat(userCreditAuth,'_.__'),	//系统送额度
	"credit":numberformat(userCredit,'_.__'),	//竞拍额度
	"usableCredit":numberformat(userCreditLimit,'_.__'),	//可用额度
	"occupyCredit":numberformat(occupyCredit,'_.__'),	//己占用额度 
	"margin":numberformat(deposit,'_.__'),	//保证金
	"usableMargin":numberformat(kybzj,'_.__'),	//可用保证金
	"occupyMargin":numberformat(yzybzj,'_.__'),	//己占用保证金
	"balance":numberformat(getuserrecharge,'_.__'),
	"rate":50
}
};
</cfscript>
  </cfif>
  
  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>


<!---明细记录接口--->
<cffunction name="recharge" access="remote" returnFormat="json">
<cfparam name="type" default="1">
<cfscript>
	j = {"success":"0"};
	detailRecord = arraynew(1);
</cfscript>
<!---根据UUID查找ID--->
<cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
<cfif uuidgetuid.recordcount neq 1>
	<!---,"msg":"用户ID错误"--->
	<cfset j = {"success":"0","errCode":"0"}>
<cfelse>
	<cfinvoke component="app.cfc.recharge" method="userrecharge" returnvariable="userrecharge" uid="#uuidgetuid.uid#" />
	<cfoutput query="userrecharge">
		<cfscript>
			if (process_type eq 0){
				add = amount;
				reduce = '';
			}else{
				add = '';
				reduce = amount;
			}
			listjson = {
			"time":datetimeformat(dt,'yyyy-mm-dd HH:NN:SS'),
			"category":financeType,
			"add":add,
			"reduce":reduce,
			"warehouse":""
			};
			arrayappend(detailRecord,listjson);
		</cfscript>
	</cfoutput>
	<cfscript>
		j = {"success":"1","detailRecord":detailRecord};
	</cfscript>
</cfif>
<cfscript>
	j = createObject("component",'cfjson').encode(j);
	return j;
</cfscript>
</cffunction>


<!---10月新增部分--->

<cffunction name="points" access="remote" returnFormat="json">
<cfparam name="type" default="2">
  <cfscript>
	j = {"success":"0"};
	detailRecord = arraynew(1);
	</cfscript>
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
  <cfif uuidgetuid.recordcount neq 1>
  	<!---,"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
  
<cfinvoke component="app.cfc.points" method="userpoints" returnvariable="userpoints" uid="#uuidgetuid.uid#" />

<cfoutput query="userpoints">
<cfscript>
if (changepoints gte 0){
	add = changepoints;
	reduce = '';
}
else {
	add = '';
	reduce = -changepoints;
}

listjson = {
"time":datetimeformat(dt,'yyyy-mm-dd HH:NN:SS'),
"category":pointsType,
"add":add,
"reduce":reduce,
"orderId":orderId
};
arrayappend(detailRecord,listjson);
</cfscript>
</cfoutput>
<cfscript>
j = {"success":"1","detailRecord":detailRecord};
</cfscript>
  </cfif>

  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>




<!---竞价额度接口--->
<cffunction name="userjjed" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#">
  <cfif uuidgetuid.recordcount neq 1>
  	<cfscript>
		//,"msg":"用户ID错误"
		j = {"success":"0","errCode":"0"};
		</cfscript>
  <cfelse>
	<!---可用保证金额度 --->
    <cfinvoke component="app.cfc.deposit" method="getbzj_ed" returnvariable="usevalue" uid="#uuidgetuid.uid#" />
    <!---冻结保证金额度--->
    <cfinvoke component="app.cfc.deposit" method="getbzj_dj_ed" returnvariable="dusevalue" uid="#uuidgetuid.uid#" />
    <cfscript>
		j = {"success":"1",
				"auction":{
					"usable":usevalue,
					"occupy":dusevalue,
					"url":"http://adio.chinalaohu.com/app/doc/help/auction1-1.html"
				}
		};
		</cfscript>
  </cfif>
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>
</cffunction>

<!---保证金接口--->
<cffunction name="userbzj" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#">
  <cfif uuidgetuid.recordcount neq 1>
  	<cfscript>
		//,"msg":"用户ID错误"
		j = {"success":"0","errCode":"0"};
		</cfscript>
  <cfelse>
	<!---保证金可用额度--->
    <cfinvoke component="app.cfc.deposit" method="getbzjvalue" returnvariable="userdeposit" uid="#uuidgetuid.uid#" />
	<!--- 保证金冻结额度 --->
	<cfinvoke component="app.cfc.deposit" method="get_dj_bzjvalue" returnvariable="occupy" uid="#uuidgetuid.uid#" />
	
    <cfscript>
		j = {"success":"1",
			"margin":{
				"all":numberformat(userdeposit,'_.__'),
				"occupy":numberformat(occupy,'_.__'),
				"url":"http://adio.chinalaohu.com/app/doc/help/auction1-2.html"
			}
		};
		</cfscript>
		
	<!--- 该部分比较繁琐，而且算出的数值也是错的
    <!---认证额度--->
    <cfinvoke component="app.cfc.credit" method="userCreditAuth" returnvariable="userCreditAuth" uid="#uuidgetuid.uid#" />
    <!---竞拍额度--->
    <cfinvoke component="app.cfc.credit" method="userCredit" returnvariable="userCredit" CreditLimit="#userCreditAuth#" uid="#uuidgetuid.uid#" />
    <cfscript>
    //保证金
    if (userdeposit eq 0){
    	deposit = 0.00;
			//kybzj = 0;
		}
    else {
    	deposit = userdeposit;
			//可用保证金
			//kybzj = deposit;
		}
		
		//占用额度		
		occupy = userCredit - userCreditAuth;
		//占用额度换算成占用保证金
		occupy = occupy / 50;
		//占用保证金>总保证
		if (occupy gt deposit ){
			occupy = deposit;
		}
		
		
		j = {"success":"1",
			"margin":{
				"all":numberformat(deposit,'_.__'),
				"occupy":numberformat(occupy,'_.__'),
				"url":"http://adio.chinalaohu.com/app/doc/help/auction1-2.html"
			}
		};
		</cfscript>
		--->
    
    
  </cfif>

  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>
</cffunction>

<!---积分接口--->
<cffunction name="userjf" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	</cfscript>
  
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#">
  <cfif uuidgetuid.recordcount neq 1>
  	<cfscript>
		//,"msg":"用户ID错误"
		j = {"success":"0","errCode":"0"};
		</cfscript>
  <cfelse>
		<!---积分--->
    <cfinvoke component="app.cfc.points" method="userpoints" returnvariable="userpoints" uid="#uuidgetuid.uid#" />
    <cfscript>
    //积分
    if (userpoints.recordcount eq 0){
    	points = 0;
		}
    else {
    	points = userpoints.points;
		}
		
		j = {"success":"1",
			"points":{
				"usable":points,
				"used":"0",
				"url":"http://adio.chinalaohu.com/app/doc/help/auction1-3.html"
			}
		};
		</cfscript>
    
    
  </cfif>

  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>
</cffunction>

<!---竞拍额度赠送明细记录接口--->
<cffunction name="glftcredit" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	detailRecord = arraynew(1);
	</cfscript>
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
  <cfif uuidgetuid.recordcount neq 1>
  	<!---,"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
  
<cfinvoke component="app.cfc.credit" method="userglftcreditlist" returnvariable="userglftcreditlist" uid="#uuidgetuid.uid#" />

<cfoutput query="userglftcreditlist">
<cfscript>
switch(glftlevel){
	case 1:
		category = '注册会员';
		break;
	case 2:
		category = '完整资料认证';
		break;
	case 4:
		category = '升级成4钻会员';
		break;
	case 5:
		category = '升级成5钻会员';
		break;
	case 6:
		category = '升级成1皇冠会员';
		break;
}
add = '';
reduce = '';
if (credit gte 0){
	add = credit;
}
else {
	reduce = - credit;
}


listjson = {
"time":datetimeformat(senddt,'yyyy-mm-dd HH:NN:SS'),
"category":category,
"add":add,
"reduce":reduce,
"confirm":isenabled
};
arrayappend(detailRecord,listjson);
</cfscript>
</cfoutput>
<cfscript>
j = {"success":"1","detailRecord":detailRecord};
</cfscript>
  </cfif>

  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>


<cffunction name="usesCredit" access="remote" returnFormat="json">
	<cfscript>
		j = {"success":"0"};
		detailRecord = arraynew(1);
	</cfscript>
	<!---根据UUID查找ID--->
	<cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
	<cfif uuidgetuid.recordcount neq 1>
		<!---,"msg":"用户ID错误"--->
		<cfset j = {"success":"0","errCode":"0"}>
	<cfelse>
	<!--- 第一条语句 非代理（中标的）   第二条语句 代理（竞价中的冻结USERBIDPROXY的出价，中标的冻结当前USERLASTBID的出价）竞价的   第三条语句 中标的--->
		<cfquery datasource="#DB#" name="res">
 select a.aid as aid,a.bid_dt,b.acode,a.bid as reason,b.auction,'未支付占用' as occupy from auction_userlastbid a  left outer join auction b  on a.aid=b.aid  where   a.is_bid=1 and a.pay_status!=2 and a.uid=#uuidgetuid.uid# and a.aid not in (  select aid   from auction_userbidproxy where uid=#uuidgetuid.uid#  and is_bid=1  and aid  in (  select aid from auction_userlastbid where uid=#uuidgetuid.uid#  and is_bid=1  and pay_status!=2 )  )  


 union    select a.aid as aid,a.bidproxy_dt as bit_dt,b.acode,a.bidproxy as reason,b.auction,'最高价占用' as occupy  from auction_userbidproxy  a  left outer join auction b on a.aid=b.aid   where a.uid=#uuidgetuid.uid#  and a.is_bid=1  and a.aid  in (  select aid from auction_userlastbid where uid=#uuidgetuid.uid#  and is_bid=1  and pay_status!=2 )  and a.aid in (select aid from auction where  asid in (select asid from auction_special where now()<=asclosetime))  
 
 
  union    select a.aid as aid,c.bid_dt as bid_dt,b.acode,c.bid as reason,b.auction,'最高价占用' as occupy  from auction_userbidproxy  a  left outer join auction b on a.aid=b.aid  left outer join auction_userlastbid c on a.aid=c.aid and a.uid=c.uid   where a.uid=#uuidgetuid.uid#  and a.is_bid=1  and a.aid  in (  select aid from auction_userlastbid where uid=#uuidgetuid.uid#  and is_bid=1  and pay_status!=2 )  and a.aid in (select aid from auction where  asid in (select asid from auction_special where now()>asclosetime)) 
		</cfquery>
		<cfoutput query="res">
			<cfscript>
				listjson = {
					"aID":aid,
					"time":datetimeformat(bid_dt,'yyyy-mm-dd HH:NN:SS'),
					"number":acode,
					"name":auction,
					"type":"竞拍",
					"occupy":occupy,
					"reason":reason
				};
				arrayappend(detailRecord,listjson);
			</cfscript>
		</cfoutput>
		<cfset j = {"success":"1","detailRecord":detailRecord} >
	</cfif>
	<cfscript>
		j = createObject("component",'cfjson').encode(j);
		return j;
	</cfscript>
</cffunction>

<!---竞拍额度占用明细记录接口 老的，已经不用--->
<cffunction name="usesCredit2" access="remote" returnFormat="json">
  <cfscript>
	j = {"success":"0"};
	detailRecord = arraynew(1);
	</cfscript>
	<!---根据UUID查找ID--->
  <cfinvoke component="app.cfc.user" method="uuidgetuid" returnvariable="uuidgetuid" UUID="#uuid#"/>
  <cfif uuidgetuid.recordcount neq 1>
  	<!---,"msg":"用户ID错误"--->
    <cfset j = {"success":"0","errCode":"0"}>
  <cfelse>
  	<!---查找占用拍品--->
    <cfquery datasource="#DB#" name="lastbiduse">
    SELECT
    auction_userlastbid.aid,
    auction_userlastbid.bid,
    auction_userlastbid.bid_dt,
    auction_userlastbid.is_bid,
    auction_userlastbid.wonID,
    auction.acode,
    auction.auction,auction.endtime
    FROM
    auction_userlastbid
    INNER JOIN auction ON auction.aid = auction_userlastbid.aid
    WHERE
    auction_userlastbid.uid = #uuidgetuid.uid# AND
    auction_userlastbid.is_bid = 1 AND
    auction.atag >= 0
    order by bid_dt asc
    </cfquery>
    
    <cfoutput query="lastbiduse">
    <cfscript>
		reason = '最高价占用';
		dontadd = 0;
		time = bid_dt;
		occupy = bid;		
		</cfscript>
    <!---查找是否已下单--->
    <cfif wonid gt 0>
      <cfquery datasource="#DB#" name="checkpayed">
      SELECT
      auction_userwonpaid.pay_status
      FROM
      auction_userwon
      INNER JOIN auction_userwonpaid ON auction_userwonpaid.paidID = auction_userwon.paidID
      WHERE
      auction_userwon.wonID = #wonid#
      </cfquery>
      
      <cfscript>
      if (checkpayed.pay_status gt 0){
        
        reason = '未支付占用';
      }
      else {
        //不用加入
        dontadd = 1;
      }
      </cfscript>
    <cfelse>
    	<!---查找代理出价--->
      <cfquery datasource="#DB#" name="checkproxyed">
      SELECT
      auction_userbidproxy.aid,
      auction_userbidproxy.uid,
      auction_userbidproxy.bidproxy,
      auction_userbidproxy.bidproxy_dt,
      auction_userbidproxy.limittime
      FROM
      auction_userbidproxy
      WHERE
      aid = #aid# AND
      uid = #uuidgetuid.uid# AND
      limittime >= now()
      </cfquery>
      <cfscript>
			if (checkproxyed.recordcount gt 0){
				occupy = checkproxyed.bidproxy;
				time = checkproxyed.bidproxy_dt;
			}	
			</cfscript> 
      
    
    
    </cfif>
    
    

		<cfscript>
		if (dontadd eq 0){
		listjson = {
			"aID": aid,
			"time":datetimeformat(time,'yyyy-mm-dd HH:NN:SS'),
		  "number":acode,
		  "name":auction,
		  "type":"竞拍",
		  "occupy":occupy,
      "reason":reason
		};
		
		arrayappend(detailRecord,listjson);
		}
		</cfscript>


    
    </cfoutput>
    
    


    
    

		<cfscript>
    j = {"success":"1","detailRecord":detailRecord};
    </cfscript>


  </cfif>

  
  <cfscript>
	j = createObject("component",'cfjson').encode(j);
  return j;
	</cfscript>

</cffunction>










<cffunction name="usershow" access="public" returntype="query">
	<cfquery datasource="#DB#" name="usershow">
  select *
  from user_base
  where muuid = '#uuid#'
  limit 1
  </cfquery>
  <cfreturn usershow >
</cffunction>
  
  
</cfcomponent>

